
/*
   Written by Chen Danqi, Yali Middle School.
   HashSize = 4001, 4Based, À¨ºÅ±íÊ¾·¨, Öð¸ñµÝÍÆ
   */

#include <cstdio>
#include <cstring>

const int maxn = 15;
const int queueSize = 200000;
const int hashSize  = 4001;

struct node
{
	int idx, nxt;
	__int64 sum;
};

bool map[maxn][maxn];
int hash[hashSize];
node f[2][queueSize];
int stack[maxn];
int m, n, tot;
int wx, wy, cur;

inline void init()
{
	scanf("%d %d", &m, &n);
	for (int i = 0; i < m; i ++)
		for (int j = 0; j < n; j ++)
		{
			char c;
			while (c = getchar(), (c != '.') && (c != '*'));
			map[i][j] = c == '.';
		}

	for (int j = n - 1; j >= 0; j --)
		for (int i = m - 1; i >= 0; i --)
			if (map[i][j]) { wx = i; wy = j; return; }
}

inline void put(int a, __int64 b)
{
	int k = a % hashSize;
	for (int tmp = hash[k]; tmp; tmp = f[cur][tmp].nxt)
		if (f[cur][tmp].idx == a)
		{
			f[cur][tmp].sum += b;
			return;
		}
	f[cur][++tot].idx = a; f[cur][tot].sum = b;
	f[cur][tot].nxt = hash[k]; hash[k] = tot;
}

inline int link(int num, int p)
{
	int top = 0;
	for (int i = 0; i <= m; i ++)
	{
		int j = num & 3;
		if (j == 1) stack[++top] = i;
		else if (j == 2)
		{
			if (p == i) return stack[top];
			if (p == stack[top]) return i;
			top --;
		}
		num >>= 2;
	}
	return 0;
}

inline void solve(int i, int j, int num, __int64 s)
{
	int left = (num >> (i + i + 2)) & 3;
	int up = (num >> (i + i)) & 3;
	int x  = num - (left << (i + i + 2)) - (up << (i + i));
	if (!map[i][j])
	{
		if (!left && !up) put(x, s);
	} else
		if (!left && !up)
		{
			if (i < m - 1 && j < n - 1) put(x + (1 << (i + i)) + (2 << (i + i + 2)), s);
		} else
			if (left && up)
			{
				if (left != up)
				{
					if (left == 1 || i == wx && j == wy) put(x, s);
				} else
					if (left == 1) put(x - (1 << (link(num, i + 1) << 1)), s);
					else put(x + (1 << (link(num, i) << 1)), s);
			} else
			{
				left += up;
				if (i < m - 1) put(x + (left << (i + i + 2)), s);
				if (j < n - 1) put(x + (left << (i + i)), s);
			}
}

inline void work()
{
	cur = 0; tot = 0;
	memset(hash, 0, sizeof(hash));
	put(0, 1);

	for (int j = 0; j < n; j ++)
		for (int i = 0; i < m; i ++)
		{
			int prev = tot; tot = 0; cur = 1 - cur;
			memset(hash, 0, sizeof(hash));
			for (int k = 1; k <= prev; k ++)
			{
				int p = f[1-cur][k].idx;
				if (!i) p <<= 2;
				solve(i, j, p, f[1-cur][k].sum);
			}
			if (i == wx && j == wy) return;
		}
}

inline void print()
{
	__int64 ans = 0;
	for (int k = 1; k <= tot; k ++)
		if (!f[cur][k].idx) ans = f[cur][k].sum;
	printf("%I64d\n", ans);
}

int main()
{
	freopen("Formula.in", "r", stdin);
	init();
	work();
	print();
	return 0;
}
